#include "sort.hpp"

#define NUM 1000000

std::vector<int> RadArray()
{
  std::vector<int> array;
  for(int i = 0; i < NUM; i++){
    array.push_back(rand());
  }

  return array;
}

void BubbleSort()
{
  std::vector<int> array = RadArray();
  int begin = clock();
  Sort::BubbleSort(array);
  int end = clock();
  printf("BubbleSort-->%d\n", end - begin);
}

void InsertSort()
{
  std::vector<int> array = RadArray();
  int begin = clock();
  Sort::InsertSort(array);
  int end = clock();
  printf("InsertSort-->%d\n", end - begin);
}

void SelectSort()
{
  std::vector<int> array = RadArray();
  int begin = clock();
  Sort::SelectSort(array);
  int end = clock();
  printf("SelectSort-->%d\n", end - begin);
}

void ShellSort()
{
  std::vector<int> array = RadArray();
  int begin = clock();
  Sort::ShellSort(array);
  int end = clock();
  printf("ShellSort-->%d\n", end - begin);
}

void HeapSort()
{
  std::vector<int> array = RadArray();
  int begin = clock();
  Sort::HeapSort(array);
  int end = clock();
  printf("HeapSort-->%d\n", end - begin);
}

void RQuickSort()
{
  std::vector<int> array = RadArray();
  int begin = clock();
  Sort::RQuickSort(array);
  int end = clock();
  printf("RQuickSort-->%d\n", end - begin);
}

void NoRQuickSort()
{
  std::vector<int> array = RadArray();
  int begin = clock();
  Sort::NoRQuickSort(array);
  int end = clock();
  printf("NoRQuickSort-->%d\n", end - begin);
}

void RMergeSort()
{
  std::vector<int> array = RadArray();
  int begin = clock();
  Sort::RMergeSort(array);
  int end = clock();
  printf("RMergeSort-->%d\n", end - begin);
}

void NoRMergeSort()
{
  std::vector<int> array = RadArray();
  int begin = clock();
  Sort::NoRMergeSort(array);
  int end = clock();
  printf("NoRMergeSort-->%d\n", end - begin);
}

int main()
{
  srand((unsigned long)time(nullptr));
  //BubbleSort();
  //InsertSort();
  //SelectSort();
  ShellSort();
  HeapSort();
  RQuickSort();
  NoRQuickSort();
  RMergeSort();
  NoRMergeSort();
  return 0;
}
